home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / plugin.jar / sun / plugin / AppletViewer.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  30.0 KB  |  1,438 lines

  1. package sun.plugin;
  2.  
  3. import com.sun.deploy.cache.Cache;
  4. import com.sun.deploy.cache.DeployCacheHandler;
  5. import com.sun.deploy.config.Config;
  6. import com.sun.deploy.net.cookie.DeployCookieSelector;
  7. import com.sun.deploy.net.offline.DeployOfflineManager;
  8. import com.sun.deploy.net.proxy.DeployProxySelector;
  9. import com.sun.deploy.perf.DeployPerfUtil;
  10. import com.sun.deploy.resources.ResourceManager;
  11. import com.sun.deploy.security.DeployAuthenticator;
  12. import com.sun.deploy.services.ServiceManager;
  13. import com.sun.deploy.ui.UIFactory;
  14. import com.sun.deploy.util.ConsoleHelper;
  15. import com.sun.deploy.util.DeploySysRun;
  16. import com.sun.deploy.util.URLUtil;
  17. import com.sun.deploy.util.UpdateCheck;
  18. import com.sun.java.browser.net.ProxyService;
  19. import java.applet.Applet;
  20. import java.applet.AppletContext;
  21. import java.awt.Color;
  22. import java.awt.Component;
  23. import java.awt.Dimension;
  24. import java.awt.Frame;
  25. import java.awt.Graphics;
  26. import java.awt.event.WindowEvent;
  27. import java.awt.event.WindowListener;
  28. import java.io.File;
  29. import java.io.IOException;
  30. import java.io.InputStream;
  31. import java.io.ObjectInputStream;
  32. import java.lang.reflect.Method;
  33. import java.net.Authenticator;
  34. import java.net.MalformedURLException;
  35. import java.net.URL;
  36. import java.net.URLConnection;
  37. import java.text.MessageFormat;
  38. import java.util.ArrayList;
  39. import java.util.HashMap;
  40. import java.util.Iterator;
  41. import java.util.Locale;
  42. import java.util.Properties;
  43. import java.util.StringTokenizer;
  44. import javax.swing.ImageIcon;
  45. import netscape.javascript.JSException;
  46. import netscape.javascript.JSObject;
  47. import sun.applet.AppletClassLoader;
  48. import sun.applet.AppletPanel;
  49. import sun.awt.AppContext;
  50. import sun.net.ProgressMonitor;
  51. import sun.net.www.MimeTable;
  52. import sun.net.www.protocol.jar.URLJarFile;
  53. import sun.plugin.cache.JarCacheUtil;
  54. import sun.plugin.extension.ExtensionInstallationImpl;
  55. import sun.plugin.javascript.JSContext;
  56. import sun.plugin.net.proxy.PluginProxyServiceProvider;
  57. import sun.plugin.perf.PluginRollup;
  58. import sun.plugin.resources.ResourceHandler;
  59. import sun.plugin.security.ActivatorSecurityManager;
  60. import sun.plugin.security.JDK11ClassFileTransformer;
  61. import sun.plugin.security.PluginClassLoader;
  62. import sun.plugin.services.BrowserService;
  63. import sun.plugin.util.GrayBoxPainter;
  64. import sun.plugin.util.PluginSysUtil;
  65. import sun.plugin.util.Trace;
  66. import sun.plugin.util.UserProfile;
  67. import sun.plugin.viewer.context.PluginAppletContext;
  68.  
  69. public class AppletViewer extends AppletPanel implements WindowListener {
  70.    private GrayBoxPainter grayBoxPainter = new GrayBoxPainter(this);
  71.    private GrayBoxListener grayBoxListener = null;
  72.    private String customBoxMessage = null;
  73.    private boolean dumpPerf = false;
  74.    private boolean loading_first_time = true;
  75.    private boolean preloading = false;
  76.    private volatile boolean stopped = false;
  77.    private static Frame dummyFrame = new Frame();
  78.    private static boolean initialized = false;
  79.    public static String theVersion = "1.1";
  80.    private URL documentURL = null;
  81.    protected URL baseURL = null;
  82.    protected HashMap atts = new HashMap();
  83.    private ClassLoaderInfo cli = null;
  84.    private static boolean fShowException = false;
  85.    public volatile boolean readyToQuit = true;
  86.    public Object appletQuitLock = new Object();
  87.    private AppletEventListener appletEventListener = new AppletEventListener((1)null);
  88.    private Object syncInit = new Object();
  89.    private boolean bInit = false;
  90.    private static final String VERSION_TAG = "version=";
  91.    private HashMap jarVersionMap = new HashMap();
  92.    private HashMap preloadJarMap = new HashMap();
  93.    private ArrayList newStyleJarList = new ArrayList();
  94.    private static final String PRELOAD = "preload";
  95.    private boolean docbaseInit = false;
  96.    private Object docBaseSyncObj = new Object();
  97.    protected boolean codeBaseInit = false;
  98.    private String classLoaderCacheKey = null;
  99.    private AppletStatusListener statusListener = null;
  100.    private PluginAppletContext appletContext;
  101.    // $FF: renamed from: is java.io.InputStream
  102.    private InputStream field_0;
  103.  
  104.    public static void loadPropertiesFiles() {
  105.       DeployPerfUtil.put("START - Java   - JVM - AppletViewer.loadPropertiesFiles");
  106.  
  107.       try {
  108.          File var0 = new File(UserProfile.getPropertyFile());
  109.          var0.getParentFile().mkdirs();
  110.       } catch (Throwable var1) {
  111.          Trace.printException(var1);
  112.       }
  113.  
  114.       DeployPerfUtil.put("END   - Java   - JVM - AppletViewer.loadPropertiesFiles");
  115.    }
  116.  
  117.    public static void setStartTime(long var0) {
  118.       String var2 = System.getProperty("sun.perflog");
  119.       if (var2 != null) {
  120.          try {
  121.             Class var3 = Class.forName("sun.misc.PerformanceLogger");
  122.             if (var3 != null) {
  123.                Class[] var4 = new Class[]{String.class, Long.TYPE};
  124.                Method var5 = var3.getMethod("setStartTime", var4);
  125.                if (var5 != null) {
  126.                   Object[] var6 = new Object[]{"Java Plug-in load time", new Long(var0)};
  127.                   var5.invoke((Object)null, var6);
  128.                }
  129.             }
  130.          } catch (Exception var7) {
  131.          }
  132.       }
  133.  
  134.    }
  135.  
  136.    public static void initEnvironment(int var0, long var1) {
  137.       if (!initialized) {
  138.          setStartTime(var1);
  139.          initEnvironment(var0);
  140.       }
  141.    }
  142.  
  143.    public static void initEnvironment(int var0) {
  144.       if (!initialized) {
  145.          initialized = true;
  146.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment");
  147.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - PluginSysUtil.getPluginThreadGroup");
  148.          PluginSysUtil.getPluginThreadGroup();
  149.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - PluginSysUtil.getPluginThreadGroup");
  150.  
  151.          try {
  152.             DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - set initial proxy");
  153.             ProxyService.setProvider(new PluginProxyServiceProvider());
  154.             DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - set initial proxy");
  155.          } catch (Exception var15) {
  156.          }
  157.  
  158.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - ServiceManager.setService");
  159.          ServiceManager.setService(var0);
  160.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - ServiceManager.setService");
  161.  
  162.          try {
  163.             Class var1 = ImageIcon.class;
  164.          } catch (Throwable var14) {
  165.          }
  166.  
  167.          try {
  168.             DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - JDK11ClassFileTransformer.init");
  169.             JDK11ClassFileTransformer.init();
  170.             DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - JDK11ClassFileTransformer.init");
  171.          } catch (Throwable var13) {
  172.             var13.printStackTrace();
  173.          }
  174.  
  175.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - load deploy.properties");
  176.          Properties var16 = Config.getProperties();
  177.          Properties var2 = new Properties(System.getProperties());
  178.          var2.put("acl.read", "+");
  179.          var2.put("acl.read.default", "");
  180.          var2.put("acl.write", "+");
  181.          var2.put("acl.write.default", "");
  182.          var2.put("browser.version", theVersion);
  183.          var2.put("browser.vendor", "Sun Microsystems, Inc.");
  184.          var2.put("http.agent", "Mozilla/4.0 (" + System.getProperty("os.name") + " " + System.getProperty("os.version") + ")");
  185.          var2.put("sun.net.http.errorstream.enableBuffering", "true");
  186.          var2.put("package.restrict.access.sun", "true");
  187.          var2.put("package.restrict.access.com.sun.deploy", "true");
  188.          var2.put("package.restrict.access.org.mozilla.jss", "true");
  189.          var2.put("package.restrict.access.netscape", "false");
  190.          var2.put("package.restrict.definition.java", "true");
  191.          var2.put("package.restrict.definition.sun", "true");
  192.          var2.put("package.restrict.definition.netscape", "true");
  193.          var2.put("package.restrict.definition.com.sun.deploy", "true");
  194.          var2.put("package.restrict.definition.org.mozilla.jss", "true");
  195.          var2.put("java.version.applet", "true");
  196.          var2.put("java.vendor.applet", "true");
  197.          var2.put("java.vendor.url.applet", "true");
  198.          var2.put("java.class.version.applet", "true");
  199.          var2.put("os.name.applet", "true");
  200.          var2.put("os.version.applet", "true");
  201.          var2.put("os.arch.applet", "true");
  202.          var2.put("file.separator.applet", "true");
  203.          var2.put("path.separator.applet", "true");
  204.          var2.put("line.separator.applet", "true");
  205.          String var3 = var2.getProperty("java.protocol.handler.pkgs");
  206.          if (var3 != null) {
  207.             var2.put("java.protocol.handler.pkgs", var3 + "|sun.plugin.net.protocol|com.sun.deploy.net.protocol");
  208.          } else {
  209.             var2.put("java.protocol.handler.pkgs", "sun.plugin.net.protocol|com.sun.deploy.net.protocol");
  210.          }
  211.  
  212.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - URLConnection.setDefaultAllowUserInteraction");
  213.          URLConnection.setDefaultAllowUserInteraction(true);
  214.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - URLConnection.setDefaultAllowUserInteraction");
  215.          if (var2.get("https.protocols") == null) {
  216.             StringBuffer var4 = new StringBuffer();
  217.             if (Config.getBooleanProperty("deployment.security.TLSv1")) {
  218.                var4.append("TLSv1");
  219.             }
  220.  
  221.             if (Config.getBooleanProperty("deployment.security.SSLv3")) {
  222.                if (var4.length() != 0) {
  223.                   var4.append(",");
  224.                }
  225.  
  226.                var4.append("SSLv3");
  227.             }
  228.  
  229.             if (Config.getBooleanProperty("deployment.security.SSLv2Hello")) {
  230.                if (var4.length() != 0) {
  231.                   var4.append(",");
  232.                }
  233.  
  234.                var4.append("SSLv2Hello");
  235.             }
  236.  
  237.             var2.put("https.protocols", var4.toString());
  238.          }
  239.  
  240.          var2.put("http.auth.serializeRequests", "true");
  241.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - JavaRunTime.initTraceEnvironment");
  242.          JavaRunTime.initTraceEnvironment();
  243.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - JavaRunTime.initTraceEnvironment");
  244.          String var17 = Config.getProperty("deployment.console.startup.mode");
  245.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - display JavaConsole");
  246.          if ("SHOW".equalsIgnoreCase(var17)) {
  247.             JavaRunTime.showJavaConsole(true);
  248.          } else if (!"DISABLE".equalsIgnoreCase(var17)) {
  249.             BrowserService var5 = (BrowserService)ServiceManager.getService();
  250.             if (var5.isConsoleIconifiedOnClose()) {
  251.                JavaRunTime.showJavaConsole(false);
  252.             }
  253.          }
  254.  
  255.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - display JavaConsole");
  256.          if ("true".equalsIgnoreCase(var2.getProperty("deployment.javapi.lifecycle.exception", "false"))) {
  257.             fShowException = true;
  258.          }
  259.  
  260.          String var18 = var2.getProperty("sun.net.client.defaultConnectTimeout", "120000");
  261.          var2.put("sun.net.client.defaultConnectTimeout", var18);
  262.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - install extension package");
  263.  
  264.          try {
  265.             Class var6 = Class.forName("sun.misc.ExtensionDependency");
  266.             if (var6 != null) {
  267.                Class[] var7 = new Class[]{Class.forName("sun.misc.ExtensionInstallationProvider")};
  268.                Method var8 = var6.getMethod("addExtensionInstallationProvider", var7);
  269.                if (var8 != null) {
  270.                   Object[] var9 = new Object[]{new ExtensionInstallationImpl()};
  271.                   var8.invoke((Object)null, var9);
  272.                } else {
  273.                   Trace.msgPrintln("optpkg.install.error.nomethod");
  274.                }
  275.             } else {
  276.                Trace.msgPrintln("optpkg.install.error.noclass");
  277.             }
  278.          } catch (Throwable var12) {
  279.             Trace.printException(var12);
  280.          }
  281.  
  282.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - install extension package");
  283.          var2.remove("proxyHost");
  284.          var2.remove("proxyPort");
  285.          var2.remove("http.proxyHost");
  286.          var2.remove("http.proxyPort");
  287.          var2.remove("https.proxyHost");
  288.          var2.remove("https.proxyPort");
  289.          var2.remove("ftpProxyHost");
  290.          var2.remove("ftpProxyPort");
  291.          var2.remove("ftpProxySet");
  292.          var2.remove("gopherProxyHost");
  293.          var2.remove("gopherProxyPort");
  294.          var2.remove("gopherProxySet");
  295.          var2.remove("socksProxyHost");
  296.          var2.remove("socksProxyPort");
  297.          if ("true".equalsIgnoreCase(var2.getProperty("javaplugin.proxy.authentication", "true"))) {
  298.             DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - enable proxy/web server authentication");
  299.             Authenticator.setDefault(new DeployAuthenticator());
  300.             DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - enable proxy/web server authentication");
  301.          }
  302.  
  303.          System.setProperties(var2);
  304.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - load deploy.properties");
  305.          System.out.println("");
  306.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - DeployProxySelector.reset");
  307.          DeployProxySelector.reset();
  308.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - DeployProxySelector.reset");
  309.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - DeployCookieSelector.reset");
  310.          DeployCookieSelector.reset();
  311.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - DeployCookieSelector.reset");
  312.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - DeployOfflineManager.reset");
  313.          DeployOfflineManager.reset();
  314.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - DeployOfflineManager.reset");
  315.          System.out.println("");
  316.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - DeployCacheHandler.reset");
  317.          Class var19 = Cache.class;
  318.          DeployCacheHandler.reset();
  319.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - DeployCacheHandler.reset");
  320.          System.out.println("");
  321.  
  322.          try {
  323.             DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - prep MIME types table");
  324.             MimeTable var20 = MimeTable.getDefaultTable();
  325.             DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - prep MIME types table");
  326.          } catch (Throwable var11) {
  327.             Trace.printException(var11);
  328.          }
  329.  
  330.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - ProgressMonitor.setDefault");
  331.          ProgressMonitor.setDefault(new sun.plugin.util.ProgressMonitor());
  332.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - ProgressMonitor.setDefault");
  333.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - install security manager");
  334.          ActivatorSecurityManager var21 = new ActivatorSecurityManager();
  335.          System.setSecurityManager(var21);
  336.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - install security manager");
  337.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - ConsoleHelper.displayHelp");
  338.          System.out.println(ConsoleHelper.displayHelp());
  339.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - ConsoleHelper.displayHelp");
  340.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - Config.validateSystemCacheDirectory");
  341.          Config.validateSystemCacheDirectory();
  342.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - Config.validateSystemCacheDirectory");
  343.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - URLJarFile.setCallBack");
  344.          URLJarFile.setCallBack(new PluginURLJarFileCallBack());
  345.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - URLJarFile.setCallBack");
  346.          if (System.getProperty("os.name").indexOf("Windows") != -1) {
  347.             DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - show update message");
  348.             UpdateCheck.showDialog();
  349.             DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - show update message");
  350.          }
  351.  
  352.          DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initEnvironment - upgrade cache");
  353.  
  354.          try {
  355.             DeploySysRun.execute(new 1());
  356.          } catch (Exception var10) {
  357.             Trace.printException(var10);
  358.          }
  359.  
  360.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment - upgrade cache");
  361.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initEnvironment");
  362.       }
  363.    }
  364.  
  365.    public void appletInit() {
  366.       if (!Config.isConfigValid()) {
  367.          UIFactory.showErrorDialog((Component)null, ResourceManager.getString("launcherrordialog.brief.message.applet"), ResourceManager.getString("enterprize.cfg.mandatory.applet", Config.getEnterprizeString()), ResourceManager.getString("error.default.title.applet"));
  368.       } else {
  369.          if (this.createClassLoader()) {
  370.             this.initApplet();
  371.          }
  372.  
  373.       }
  374.    }
  375.  
  376.    private void initJarVersionMap() {
  377.       int var1 = 1;
  378.       String var2 = this.getParameter("archive_" + var1);
  379.       if (var2 == null) {
  380.          String var13 = this.getParameter("cache_archive");
  381.          String var14 = this.getParameter("cache_version");
  382.          String var15 = this.getParameter("cache_archive_ex");
  383.  
  384.          try {
  385.             this.jarVersionMap = JarCacheUtil.getJarsWithVersion(var13, var14, var15);
  386.          } catch (Exception var12) {
  387.             Trace.printException(var12, ResourceHandler.getMessage("cache.error.text"), ResourceHandler.getMessage("cache.error.caption"));
  388.          }
  389.  
  390.          if (var15 != null) {
  391.             StringTokenizer var16 = new StringTokenizer(var15, ",", false);
  392.  
  393.             while(var16.hasMoreTokens()) {
  394.                String var8 = var16.nextToken().trim();
  395.                int var9 = var8.indexOf(59);
  396.                if (var9 != -1) {
  397.                   String var10 = var8.substring(var9);
  398.                   if (var10.toLowerCase().indexOf("preload") != -1) {
  399.                      String var11 = var8.substring(0, var9);
  400.                      this.preloadJarMap.put(var11, (Object)null);
  401.                   }
  402.                }
  403.             }
  404.          }
  405.       } else {
  406.          while(var2 != null) {
  407.             StringTokenizer var4 = new StringTokenizer(var2, ",", false);
  408.             String var5 = null;
  409.             String var6 = null;
  410.             boolean var7 = false;
  411.  
  412.             while(var4.hasMoreTokens()) {
  413.                String var3 = var4.nextToken().trim();
  414.                if (var5 == null) {
  415.                   var5 = var3;
  416.                } else if (var3.toLowerCase().startsWith("version=")) {
  417.                   var6 = var3.substring("version=".length());
  418.                } else if (var3.toLowerCase().equals("preload")) {
  419.                   var7 = true;
  420.                }
  421.             }
  422.  
  423.             if (var5 != null) {
  424.                if (var7) {
  425.                   this.preloadJarMap.put(var5, var6);
  426.                }
  427.  
  428.                this.jarVersionMap.put(var5, var6);
  429.                this.newStyleJarList.add(var5);
  430.             }
  431.  
  432.             ++var1;
  433.             var2 = this.getParameter("archive_" + var1);
  434.          }
  435.       }
  436.  
  437.    }
  438.  
  439.    private void storeJarVersionMapInAppContext() {
  440.       for(String var2 : this.jarVersionMap.keySet()) {
  441.          String var3 = (String)this.jarVersionMap.get(var2);
  442.          URL var4 = null;
  443.  
  444.          try {
  445.             var4 = new URL(this.getCodeBase(), var2);
  446.          } catch (MalformedURLException var6) {
  447.             com.sun.deploy.util.Trace.ignoredException(var6);
  448.          }
  449.  
  450.          if (var4 != null) {
  451.             AppContext.getAppContext().put(Config.getAppContextKeyPrefix() + var4.toString(), var3);
  452.          }
  453.       }
  454.  
  455.    }
  456.  
  457.    public boolean createClassLoader() {
  458.       DeployPerfUtil.put("START - Java   - ENV - AppletViewer.createClassLoader");
  459.       this.addAppletListener(this.appletEventListener);
  460.       this.initJarVersionMap();
  461.       URL var1 = this.getCodeBase();
  462.       if (var1 == null) {
  463.          return false;
  464.       } else {
  465.          try {
  466.             if (!this.jarVersionMap.isEmpty()) {
  467.                JarCacheUtil.verifyJarVersions(var1, this.getClassLoaderCacheKey(), this.jarVersionMap);
  468.             }
  469.          } catch (Exception var5) {
  470.             Trace.printException(var5, ResourceHandler.getMessage("cache.error.text"), ResourceHandler.getMessage("cache.error.caption"));
  471.          }
  472.  
  473.          this.cli = ClassLoaderInfo.find(var1, this.getClassLoaderCacheKey());
  474.          this.cli.addReference();
  475.          this.appletContext.addAppletPanelInContext(this);
  476.          synchronized(AppletViewer.class) {
  477.             super.init();
  478.          }
  479.  
  480.          DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.createClassLoader");
  481.          return true;
  482.       }
  483.    }
  484.  
  485.    public void initApplet() {
  486.       DeployPerfUtil.put("START - Java   - ENV - AppletViewer.initApplet");
  487.       Thread var1 = this.getAppletHandlerThread();
  488.       if (!this.bInit) {
  489.          String var2 = this.getParameter("image");
  490.          if (var2 != null) {
  491.             try {
  492.                URL var3 = new URL(this.getCodeBase(), var2);
  493.                this.grayBoxPainter.setCustomImageURL(var3);
  494.             } catch (MalformedURLException var6) {
  495.                var6.printStackTrace();
  496.             }
  497.          }
  498.  
  499.          this.grayBoxPainter.setProgressFilter(this.getCodeBase(), this.getJarFiles());
  500.          this.grayBoxPainter.beginPainting(var1.getThreadGroup());
  501.          this.grayBoxListener = new GrayBoxListener(this, this.customBoxMessage);
  502.          this.addMouseListener(this.grayBoxListener);
  503.       } else {
  504.          this.grayBoxPainter.resumePainting();
  505.       }
  506.  
  507.       Trace.msgPrintln("applet.progress.load");
  508.       this.sendEvent(1);
  509.       Trace.msgPrintln("applet.progress.init");
  510.       this.sendEvent(2);
  511.       synchronized(this.syncInit) {
  512.          this.bInit = true;
  513.       }
  514.  
  515.       DeployPerfUtil.put("END   - Java   - ENV - AppletViewer.initApplet");
  516.    }
  517.  
  518.    public void appletStart() {
  519.       synchronized(this.syncInit) {
  520.          if (!this.bInit) {
  521.             return;
  522.          }
  523.       }
  524.  
  525.       if (this.stopped) {
  526.          this.grayBoxPainter.suspendPainting();
  527.          this.stopped = false;
  528.       }
  529.  
  530.       Trace.msgPrintln("applet.progress.start");
  531.  
  532.       try {
  533.          DeployPerfUtil.write(new PluginRollup());
  534.          Trace.println("completed perf rollup");
  535.          this.dumpPerf = true;
  536.       } catch (IOException var3) {
  537.       }
  538.  
  539.       this.sendEvent(3);
  540.    }
  541.  
  542.    public void appletStop() {
  543.       this.stopped = true;
  544.       synchronized(this.syncInit) {
  545.          if (!this.bInit) {
  546.             return;
  547.          }
  548.       }
  549.  
  550.       if (this.grayBoxPainter != null) {
  551.          this.grayBoxPainter.suspendPainting();
  552.       }
  553.  
  554.       if (this.status == 1) {
  555.          Trace.msgPrintln("applet.progress.stoploading");
  556.          this.stopLoading();
  557.       }
  558.  
  559.       Trace.msgPrintln("applet.progress.stop");
  560.       this.sendEvent(4);
  561.    }
  562.  
  563.    public void appletDestroy() {
  564.       this.appletDestroy(1000L);
  565.    }
  566.  
  567.    public void appletDestroy(long var1) {
  568.       this.stopped = true;
  569.       synchronized(this.syncInit) {
  570.          if (!this.bInit) {
  571.             return;
  572.          }
  573.       }
  574.  
  575.       if (this.grayBoxPainter != null) {
  576.          this.grayBoxPainter.finishPainting();
  577.          this.grayBoxPainter = null;
  578.       }
  579.  
  580.       if (this.grayBoxListener != null) {
  581.          this.removeMouseListener(this.grayBoxListener);
  582.          this.grayBoxListener = null;
  583.       }
  584.  
  585.       this.removeAppletListener(this.appletEventListener);
  586.       this.appletEventListener = null;
  587.       this.appletContext.removeAppletPanelFromContext(this);
  588.       Thread var3 = this.getAppletHandlerThread();
  589.       Trace.msgPrintln("applet.progress.findinfo.0");
  590.       this.cli.removeReference();
  591.       this.cli = null;
  592.       Trace.msgPrintln("applet.progress.findinfo.1");
  593.       2 var4 = new 2(this);
  594.       Thread var5 = new Thread(var4);
  595.       var5.start();
  596.  
  597.       try {
  598.          Trace.msgPrintln("applet.progress.joining");
  599.          if (var3 != null) {
  600.             var3.join(var1);
  601.          }
  602.  
  603.          Trace.msgPrintln("applet.progress.joined");
  604.       } catch (InterruptedException var7) {
  605.       }
  606.  
  607.    }
  608.  
  609.    protected void onPrivateClose(int var1) {
  610.       Trace.msgPrintln("applet.progress.destroy");
  611.       this.sendEvent(5);
  612.       Trace.msgPrintln("applet.progress.dispose");
  613.       this.sendEvent(0);
  614.       synchronized(this.appletQuitLock) {
  615.          while(!this.readyToQuit) {
  616.             try {
  617.                this.appletQuitLock.wait();
  618.             } catch (InterruptedException var5) {
  619.             }
  620.          }
  621.       }
  622.  
  623.       Trace.msgPrintln("applet.progress.quit");
  624.       this.sendEvent(6);
  625.       this.appletContext = null;
  626.    }
  627.  
  628.    public void preRefresh() {
  629.       Cache.clearLoadedResources();
  630.       if (this.cli != null) {
  631.          ClassLoaderInfo var10000 = this.cli;
  632.          ClassLoaderInfo.markNotCachable(this.getCodeBase(), this.getClassLoaderCacheKey());
  633.       }
  634.  
  635.    }
  636.  
  637.    public String getParameter(String var1) {
  638.       var1 = var1.toLowerCase(Locale.ENGLISH);
  639.       synchronized(this.atts) {
  640.          String var3 = (String)this.atts.get(var1);
  641.          if (var3 != null) {
  642.             var3 = this.trimWhiteSpaces(var3);
  643.          }
  644.  
  645.          return var3;
  646.       }
  647.    }
  648.  
  649.    public void setParameter(String var1, Object var2) {
  650.       var1 = var1.toLowerCase(Locale.ENGLISH);
  651.       synchronized(this.atts) {
  652.          this.atts.put(var1, this.trimWhiteSpaces(var2.toString()));
  653.       }
  654.    }
  655.  
  656.    private String trimWhiteSpaces(String var1) {
  657.       if (var1 == null) {
  658.          return var1;
  659.       } else {
  660.          StringBuffer var2 = new StringBuffer();
  661.  
  662.          for(int var3 = 0; var3 < var1.length(); ++var3) {
  663.             char var4 = var1.charAt(var3);
  664.             if (var4 != '\n' && var4 != '\f' && var4 != '\r' && var4 != '\t') {
  665.                var2.append(var4);
  666.             }
  667.          }
  668.  
  669.          return var2.toString().trim();
  670.       }
  671.    }
  672.  
  673.    public void setDocumentBase(String var1) {
  674.       if (!this.docbaseInit) {
  675.          String var2 = URLUtil.canonicalize(var1);
  676.  
  677.          try {
  678.             this.documentURL = new URL(this.canonicalizeDocumentURL(var2));
  679.          } catch (Throwable var6) {
  680.             var6.printStackTrace();
  681.          }
  682.  
  683.          this.docbaseInit = true;
  684.          synchronized(this.docBaseSyncObj) {
  685.             this.docBaseSyncObj.notifyAll();
  686.          }
  687.       }
  688.  
  689.    }
  690.  
  691.    public String canonicalizeDocumentURL(String var1) {
  692.       int var2 = -1;
  693.       int var4 = var1.indexOf(35);
  694.       int var5 = var1.indexOf(63);
  695.       if (var5 != -1 && var4 != -1) {
  696.          var2 = Math.min(var4, var5);
  697.       } else if (var4 != -1) {
  698.          var2 = var4;
  699.       } else if (var5 != -1) {
  700.          var2 = var5;
  701.       }
  702.  
  703.       String var6;
  704.       if (var2 == -1) {
  705.          var6 = var1;
  706.       } else {
  707.          var6 = var1.substring(0, var2);
  708.       }
  709.  
  710.       StringBuffer var7 = new StringBuffer(var6);
  711.       int var8 = var7.toString().indexOf("|");
  712.       if (var8 >= 0) {
  713.          var7.setCharAt(var8, ':');
  714.       }
  715.  
  716.       if (var2 != -1) {
  717.          var7.append(var1.substring(var2));
  718.       }
  719.  
  720.       return var7.toString();
  721.    }
  722.  
  723.    public URL getDocumentBase() {
  724.       Object var1 = new Object();
  725.       synchronized(var1) {
  726.          if (!this.docbaseInit) {
  727.             BrowserService var3 = (BrowserService)ServiceManager.getService();
  728.             if (var3.isNetscape() && var3.getBrowserVersion() >= 5.0F) {
  729.                try {
  730.                   synchronized(this.docBaseSyncObj) {
  731.                      while(!this.docbaseInit) {
  732.                         this.docBaseSyncObj.wait(0L);
  733.                      }
  734.                   }
  735.                } catch (InterruptedException var11) {
  736.                   var11.printStackTrace();
  737.                }
  738.             } else {
  739.                JSContext var4 = (JSContext)this.getAppletContext();
  740.  
  741.                try {
  742.                   JSObject var5 = var4.getJSObject();
  743.                   if (var5 == null) {
  744.                      throw new JSException("Unable to obtain Window object");
  745.                   }
  746.  
  747.                   JSObject var6 = (JSObject)var5.getMember("document");
  748.                   if (var6 == null) {
  749.                      throw new JSException("Unable to obtain Document object");
  750.                   }
  751.  
  752.                   String var7 = (String)var6.getMember("URL");
  753.                   String var8 = URLUtil.canonicalize(var7);
  754.                   this.documentURL = new URL(this.canonicalizeDocumentURL(var8));
  755.                } catch (Throwable var12) {
  756.                   Trace.println(var12.getMessage());
  757.                   return null;
  758.                }
  759.  
  760.                this.docbaseInit = true;
  761.             }
  762.          }
  763.       }
  764.  
  765.       return this.documentURL;
  766.    }
  767.  
  768.    public URL getCodeBase() {
  769.       Object var1 = new Object();
  770.       synchronized(var1) {
  771.          if (!this.codeBaseInit) {
  772.             String var3 = this.getParameter("java_codebase");
  773.             if (var3 == null) {
  774.                var3 = this.getParameter("codebase");
  775.             }
  776.  
  777.             URL var4 = this.getDocumentBase();
  778.             if (var4 == null) {
  779.                return null;
  780.             }
  781.  
  782.             if (var3 != null) {
  783.                if (!var3.equals(".") && !var3.endsWith("/")) {
  784.                   var3 = var3 + "/";
  785.                }
  786.  
  787.                var3 = URLUtil.canonicalize(var3);
  788.  
  789.                try {
  790.                   this.baseURL = new URL(var4, var3);
  791.                } catch (MalformedURLException var10) {
  792.                }
  793.             }
  794.  
  795.             if (this.baseURL == null) {
  796.                String var5 = var4.toString();
  797.                int var6 = var5.indexOf(63);
  798.                if (var6 > 0) {
  799.                   var5 = var5.substring(0, var6);
  800.                }
  801.  
  802.                var6 = var5.lastIndexOf(47);
  803.                if (var6 > -1 && var6 < var5.length() - 1) {
  804.                   try {
  805.                      this.baseURL = new URL(URLUtil.canonicalize(var5.substring(0, var6 + 1)));
  806.                   } catch (MalformedURLException var9) {
  807.                   }
  808.                }
  809.  
  810.                if (this.baseURL == null) {
  811.                   this.baseURL = var4;
  812.                }
  813.             }
  814.  
  815.             this.codeBaseInit = true;
  816.          }
  817.       }
  818.  
  819.       return this.baseURL;
  820.    }
  821.  
  822.    public int getWidth() {
  823.       String var1 = this.getParameter("width");
  824.       return var1 != null ? Integer.valueOf(var1) : 0;
  825.    }
  826.  
  827.    public int getHeight() {
  828.       String var1 = this.getParameter("height");
  829.       return var1 != null ? Integer.valueOf(var1) : 0;
  830.    }
  831.  
  832.    public boolean hasInitialFocus() {
  833.       if (!this.isJDK11Applet() && !this.isJDK12Applet()) {
  834.          String var1 = this.getParameter("initial_focus");
  835.          if (var1 != null && var1.toLowerCase().equals("false")) {
  836.             return false;
  837.          } else {
  838.             return !Config.getInstance().isNativeModalDialogUp();
  839.          }
  840.       } else {
  841.          return false;
  842.       }
  843.    }
  844.  
  845.    public String getCode() {
  846.       String var1 = this.getParameter("classid");
  847.       Object var2 = null;
  848.       if (var1 != null) {
  849.          int var3 = var1.indexOf("java:");
  850.          if (var3 > -1) {
  851.             String var4 = var1.substring(5 + var3);
  852.             if (var4 != null || !var4.equals("")) {
  853.                return var4;
  854.             }
  855.          }
  856.       }
  857.  
  858.       String var5 = this.getParameter("java_code");
  859.       if (var5 == null) {
  860.          var5 = this.getParameter("code");
  861.       }
  862.  
  863.       return var5;
  864.    }
  865.  
  866.    public boolean isLegacyLifeCycle() {
  867.       String var1 = this.getParameter("legacy_lifecycle");
  868.       return var1 != null && var1.equalsIgnoreCase("true");
  869.    }
  870.  
  871.    public String getClassLoaderCacheKey() {
  872.       String var1 = this.getParameter("classloader-policy");
  873.       if (var1 != null && var1.equals("classic")) {
  874.          return super.getClassLoaderCacheKey();
  875.       } else {
  876.          if (this.classLoaderCacheKey == null) {
  877.             StringBuffer var2 = new StringBuffer();
  878.             var2.append(this.getCodeBase());
  879.             String var3 = this.getJarFiles();
  880.             if (var3 != null) {
  881.                var2.append(",");
  882.                var2.append(var3);
  883.             }
  884.  
  885.             this.classLoaderCacheKey = var2.toString();
  886.          }
  887.  
  888.          return this.classLoaderCacheKey;
  889.       }
  890.    }
  891.  
  892.    private static synchronized String getJarsInCacheArchiveEx(String var0) {
  893.       if (var0 == null) {
  894.          return null;
  895.       } else {
  896.          String var1 = "";
  897.          StringTokenizer var2 = new StringTokenizer(var0, ",", false);
  898.          int var3 = var2.countTokens();
  899.  
  900.          for(int var4 = 0; var4 < var3; ++var4) {
  901.             String var5 = var2.nextToken().trim();
  902.             int var6 = var5.indexOf(";");
  903.             if (var6 != -1) {
  904.                String var7 = var5.substring(0, var6);
  905.                var1 = var1 + var7;
  906.                var1 = var1 + (var4 != var3 - 1 ? "," : "");
  907.             }
  908.          }
  909.  
  910.          return var1;
  911.       }
  912.    }
  913.  
  914.    public String getJarFiles() {
  915.       StringBuffer var1 = null;
  916.       if (!this.newStyleJarList.isEmpty()) {
  917.          Iterator var8 = this.newStyleJarList.iterator();
  918.  
  919.          while(var8.hasNext()) {
  920.             if (var1 == null) {
  921.                var1 = new StringBuffer();
  922.             }
  923.  
  924.             String var9 = (String)var8.next();
  925.             var1.append(var9);
  926.             if (var8.hasNext()) {
  927.                var1.append(",");
  928.             }
  929.          }
  930.  
  931.          return this.addJarFileToPath(var1 == null ? null : var1.toString(), (String)null);
  932.       } else {
  933.          String var2 = this.getParameter("archive");
  934.          String var3 = this.getParameter("java_archive");
  935.          String var4 = this.getParameter("cache_archive");
  936.          String var5 = this.getParameter("cache_archive_ex");
  937.          String var6 = null;
  938.          if (var5 != null) {
  939.             int var7 = var5.indexOf(";");
  940.             if (var7 != -1) {
  941.                var6 = getJarsInCacheArchiveEx(var5);
  942.             } else {
  943.                var6 = var5;
  944.             }
  945.          }
  946.  
  947.          return this.addJarFileToPath(var6, this.addJarFileToPath(var4, this.addJarFileToPath(var3, var2)));
  948.       }
  949.    }
  950.  
  951.    private String addJarFileToPath(String var1, String var2) {
  952.       if (var1 == null && var2 == null) {
  953.          return null;
  954.       } else if (var1 == null && var2 != null) {
  955.          return var2;
  956.       } else {
  957.          return var1 != null && var2 == null ? var1 : var1 + "," + var2;
  958.       }
  959.    }
  960.  
  961.    private void loadLocalJarFiles(PluginClassLoader var1, String var2) {
  962.       File var3 = new File(var2);
  963.       if (var3.exists()) {
  964.          String[] var4 = var3.list(new 3(this));
  965.  
  966.          for(int var5 = 0; var5 < var4.length; ++var5) {
  967.             try {
  968.                URL var6 = (new File(var2 + File.separator + var4[var5])).toURI().toURL();
  969.                var1.addLocalJar(var6);
  970.             } catch (MalformedURLException var7) {
  971.                var7.printStackTrace();
  972.             }
  973.          }
  974.       }
  975.  
  976.    }
  977.  
  978.    protected void setupAppletAppContext() {
  979.       this.storeJarVersionMapInAppContext();
  980.       AppContext.getAppContext().put("deploy.trust.decider.app.name", this.getName());
  981.    }
  982.  
  983.    protected void loadJarFiles(AppletClassLoader var1) throws IOException, InterruptedException {
  984.       if (this.loading_first_time) {
  985.          this.loading_first_time = false;
  986.  
  987.          try {
  988.             this.preloading = true;
  989.             JarCacheUtil.preload(this.getCodeBase(), this.preloadJarMap);
  990.             this.preloading = false;
  991.          } catch (Exception var9) {
  992.             Trace.printException(var9, ResourceHandler.getMessage("cache.error.text"), ResourceHandler.getMessage("cache.error.caption"));
  993.          }
  994.       }
  995.  
  996.       String var2 = this.getJarFiles();
  997.  
  998.       try {
  999.          this.cli.lock();
  1000.          if (!this.cli.getLocalJarsLoaded() && var1 instanceof PluginClassLoader) {
  1001.             String var3 = File.separator;
  1002.             String var4 = System.getProperty("java.home") + var3 + "lib" + var3 + "applet";
  1003.             this.loadLocalJarFiles((PluginClassLoader)var1, var4);
  1004.             if (Config.getOSName().equalsIgnoreCase("Windows")) {
  1005.                String var5 = Config.getSystemHome() + var3 + "Lib" + var3 + "Untrusted";
  1006.                this.loadLocalJarFiles((PluginClassLoader)var1, var5);
  1007.             }
  1008.  
  1009.             this.cli.setLocalJarsLoaded(true);
  1010.          }
  1011.  
  1012.          if (var2 != null) {
  1013.             StringTokenizer var11 = new StringTokenizer(var2, ",", false);
  1014.  
  1015.             while(var11.hasMoreTokens()) {
  1016.                String var12 = var11.nextToken().trim();
  1017.                if (!this.cli.hasJar(var12)) {
  1018.                   this.cli.addJar(var12);
  1019.                }
  1020.             }
  1021.  
  1022.             super.loadJarFiles(var1);
  1023.             return;
  1024.          }
  1025.       } finally {
  1026.          this.cli.unlock();
  1027.       }
  1028.  
  1029.    }
  1030.  
  1031.    public String getSerializedObject() {
  1032.       String var1 = this.getParameter("java_object");
  1033.       if (var1 == null) {
  1034.          var1 = this.getParameter("object");
  1035.       }
  1036.  
  1037.       return var1;
  1038.    }
  1039.  
  1040.    public Applet getApplet() {
  1041.       Applet var1 = super.getApplet();
  1042.       if (var1 != null) {
  1043.          return var1 instanceof BeansApplet ? null : var1;
  1044.       } else {
  1045.          return null;
  1046.       }
  1047.    }
  1048.  
  1049.    public Object getViewedObject() {
  1050.       Applet var1 = super.getApplet();
  1051.       return var1 instanceof BeansApplet ? ((BeansApplet)var1).bean : var1;
  1052.    }
  1053.  
  1054.    public void setAppletContext(AppletContext var1) {
  1055.       if (var1 == null) {
  1056.          throw new IllegalArgumentException("AppletContext");
  1057.       } else {
  1058.          if (this.appletContext != null) {
  1059.             this.appletContext.removeAppletPanelFromContext(this);
  1060.          }
  1061.  
  1062.          this.appletContext = (PluginAppletContext)var1;
  1063.       }
  1064.    }
  1065.  
  1066.    public AppletContext getAppletContext() {
  1067.       return this.appletContext;
  1068.    }
  1069.  
  1070.    public void setColorAndText() {
  1071.       Object var1 = null;
  1072.       String var2 = this.getParameter("boxbgcolor");
  1073.       if (var2 != null) {
  1074.          Color var6 = this.createColor("boxbgcolor", var2);
  1075.          if (var6 != null) {
  1076.             this.grayBoxPainter.setBoxBGColor(var6);
  1077.          }
  1078.       }
  1079.  
  1080.       this.setBackground(this.grayBoxPainter.getBoxBGColor());
  1081.       String var3 = this.getParameter("boxfgcolor");
  1082.       if (var3 != null) {
  1083.          Color var7 = this.createColor("boxfgcolor", var3);
  1084.          if (var7 != null) {
  1085.             this.grayBoxPainter.setBoxFGColor(var7);
  1086.          }
  1087.       }
  1088.  
  1089.       String var4 = this.getParameter("progresscolor");
  1090.       if (var4 != null) {
  1091.          Color var8 = this.createColor("progresscolor", var4);
  1092.          if (var8 != null) {
  1093.             this.grayBoxPainter.setProgressColor(var8);
  1094.          }
  1095.       }
  1096.  
  1097.       this.customBoxMessage = this.getParameter("boxmessage");
  1098.       if (this.customBoxMessage != null) {
  1099.          this.grayBoxPainter.setWaitingMessage(this.customBoxMessage);
  1100.       } else {
  1101.          this.grayBoxPainter.setWaitingMessage(this.getWaitingMessage());
  1102.       }
  1103.  
  1104.       String var5 = this.getParameter("progressbar");
  1105.       if (var5 != null) {
  1106.          this.grayBoxPainter.enableProgressBar(new Boolean(var5));
  1107.       }
  1108.  
  1109.    }
  1110.  
  1111.    private Color createColor(String var1, String var2) {
  1112.       if (var2 != null && var2.indexOf(",") != -1) {
  1113.          StringTokenizer var3 = new StringTokenizer(var2, ",");
  1114.          if (var3.countTokens() == 3) {
  1115.             int var4 = 0;
  1116.             int var5 = 0;
  1117.             int var6 = 0;
  1118.  
  1119.             int var7;
  1120.             for(var7 = 0; var3.hasMoreTokens(); ++var4) {
  1121.                String var8 = (String)var3.nextElement();
  1122.                switch (var4) {
  1123.                   case 0:
  1124.                      if (!var8.trim().equals("")) {
  1125.                         var5 = new Integer(var8.trim());
  1126.                      }
  1127.                      break;
  1128.                   case 1:
  1129.                      if (!var8.trim().equals("")) {
  1130.                         var6 = new Integer(var8.trim());
  1131.                      }
  1132.                      break;
  1133.                   case 2:
  1134.                      if (!var8.trim().equals("")) {
  1135.                         var7 = new Integer(var8.trim());
  1136.                      }
  1137.                }
  1138.             }
  1139.  
  1140.             return new Color(var5, var6, var7);
  1141.          } else {
  1142.             Trace.msgPrintln("applet_viewer.color_tag", new Object[]{var1});
  1143.             return null;
  1144.          }
  1145.       } else {
  1146.          if (var2 != null) {
  1147.             try {
  1148.                return Color.decode(var2);
  1149.             } catch (NumberFormatException var9) {
  1150.                if (var2.equalsIgnoreCase("red")) {
  1151.                   return Color.red;
  1152.                }
  1153.  
  1154.                if (var2.equalsIgnoreCase("yellow")) {
  1155.                   return Color.yellow;
  1156.                }
  1157.             }
  1158.  
  1159.             if (var2.equalsIgnoreCase("black")) {
  1160.                return Color.black;
  1161.             }
  1162.  
  1163.             if (var2.equalsIgnoreCase("blue")) {
  1164.                return Color.blue;
  1165.             }
  1166.  
  1167.             if (var2.equalsIgnoreCase("cyan") || var2.equalsIgnoreCase("aqua")) {
  1168.                return Color.cyan;
  1169.             }
  1170.  
  1171.             if (var2.equalsIgnoreCase("darkGray")) {
  1172.                return Color.darkGray;
  1173.             }
  1174.  
  1175.             if (var2.equalsIgnoreCase("gray")) {
  1176.                return Color.gray;
  1177.             }
  1178.  
  1179.             if (var2.equalsIgnoreCase("lightGray") || var2.equalsIgnoreCase("silver")) {
  1180.                return Color.lightGray;
  1181.             }
  1182.  
  1183.             if (var2.equalsIgnoreCase("green") || var2.equalsIgnoreCase("lime")) {
  1184.                return Color.green;
  1185.             }
  1186.  
  1187.             if (var2.equalsIgnoreCase("magenta") || var2.equalsIgnoreCase("fuchsia")) {
  1188.                return Color.magenta;
  1189.             }
  1190.  
  1191.             if (var2.equalsIgnoreCase("orange")) {
  1192.                return Color.orange;
  1193.             }
  1194.  
  1195.             if (var2.equalsIgnoreCase("pink")) {
  1196.                return Color.pink;
  1197.             }
  1198.  
  1199.             if (var2.equalsIgnoreCase("white")) {
  1200.                return Color.white;
  1201.             }
  1202.  
  1203.             if (var2.equalsIgnoreCase("maroon")) {
  1204.                return new Color(128, 0, 0);
  1205.             }
  1206.  
  1207.             if (var2.equalsIgnoreCase("purple")) {
  1208.                return new Color(128, 0, 128);
  1209.             }
  1210.  
  1211.             if (var2.equalsIgnoreCase("navy")) {
  1212.                return new Color(0, 0, 128);
  1213.             }
  1214.  
  1215.             if (var2.equalsIgnoreCase("teal")) {
  1216.                return new Color(0, 128, 128);
  1217.             }
  1218.  
  1219.             if (var2.equalsIgnoreCase("olive")) {
  1220.                return new Color(128, 128, 0);
  1221.             }
  1222.          }
  1223.  
  1224.          return null;
  1225.       }
  1226.    }
  1227.  
  1228.    public void paint(Graphics var1) {
  1229.       Dimension var2 = this.getSize();
  1230.       if (var2.width <= 0 || var2.height <= 0 || this.status != 1 && this.status != 2 && this.status != 7) {
  1231.          super.paint(var1);
  1232.       } else {
  1233.          this.paintForegrnd(var1);
  1234.       }
  1235.  
  1236.    }
  1237.  
  1238.    public Color getForeground() {
  1239.       Color var1 = super.getForeground();
  1240.       if (null == var1) {
  1241.          var1 = Color.BLACK;
  1242.       }
  1243.  
  1244.       return var1;
  1245.    }
  1246.  
  1247.    public void paintForegrnd(Graphics var1) {
  1248.       if (this.grayBoxPainter != null) {
  1249.          this.grayBoxPainter.paintGrayBox(this, var1);
  1250.       }
  1251.  
  1252.    }
  1253.  
  1254.    public String getWaitingMessage() {
  1255.       if (this.status == 7) {
  1256.          return getMessage("failed");
  1257.       } else {
  1258.          MessageFormat var1 = new MessageFormat(getMessage("loading"));
  1259.          return var1.format(new Object[]{this.getHandledType()});
  1260.       }
  1261.    }
  1262.  
  1263.    protected void load(InputStream var1) {
  1264.       this.field_0 = var1;
  1265.    }
  1266.  
  1267.    protected Applet createApplet(AppletClassLoader var1) throws ClassNotFoundException, IllegalAccessException, IOException, InstantiationException, InterruptedException {
  1268.       if (this.field_0 == null) {
  1269.          return super.createApplet(var1);
  1270.       } else {
  1271.          AppletObjectInputStream var2 = new AppletObjectInputStream(this.field_0, var1);
  1272.          Object var3 = ((ObjectInputStream)var2).readObject();
  1273.          Applet var4 = (Applet)var3;
  1274.          this.doInit = false;
  1275.          if (Thread.interrupted()) {
  1276.             try {
  1277.                this.status = 0;
  1278.                Object var8 = null;
  1279.                this.showAppletStatus("death");
  1280.             } finally {
  1281.                Thread.currentThread().interrupt();
  1282.             }
  1283.  
  1284.             return null;
  1285.          } else {
  1286.             this.field_0 = null;
  1287.             return var4;
  1288.          }
  1289.       }
  1290.    }
  1291.  
  1292.    public String getName() {
  1293.       String var1 = this.getParameter("name");
  1294.       if (var1 != null) {
  1295.          return var1;
  1296.       } else {
  1297.          var1 = this.getCode();
  1298.          if (var1 != null) {
  1299.             int var2 = var1.lastIndexOf(".class");
  1300.             if (var2 != -1) {
  1301.                var1 = var1.substring(0, var2);
  1302.             }
  1303.          } else {
  1304.             var1 = this.getSerializedObject();
  1305.             if (var1 != null) {
  1306.                int var4 = var1.lastIndexOf(".ser");
  1307.                if (var4 != -1) {
  1308.                   var1 = var1.substring(0, var4);
  1309.                }
  1310.             }
  1311.          }
  1312.  
  1313.          return var1;
  1314.       }
  1315.    }
  1316.  
  1317.    public static int getAcceleratorKey(String var0) {
  1318.       return ResourceHandler.getAcceleratorKey(var0);
  1319.    }
  1320.  
  1321.    protected String getHandledType() {
  1322.       return getMessage("java_applet");
  1323.    }
  1324.  
  1325.    public void addAppletStatusListener(AppletStatusListener var1) {
  1326.       this.statusListener = var1;
  1327.    }
  1328.  
  1329.    public void removeAppletStatusListener(AppletStatusListener var1) {
  1330.       this.statusListener = null;
  1331.    }
  1332.  
  1333.    public void setStatus(int var1) {
  1334.       this.status = var1;
  1335.    }
  1336.  
  1337.    public void showAppletLog(String var1) {
  1338.       super.showAppletLog(var1);
  1339.    }
  1340.  
  1341.    public boolean isStopped() {
  1342.       return this.stopped;
  1343.    }
  1344.  
  1345.    public void showAppletStatus(String var1) {
  1346.       if (var1 != null && !var1.equals("") && !var1.equals("\n")) {
  1347.          String var2 = this.getName();
  1348.          MessageFormat var3 = new MessageFormat(getMessage("status_applet"));
  1349.          if (var2 != null && !var1.equals("")) {
  1350.             this.getAppletContext().showStatus(var3.format(new Object[]{var2, var1}));
  1351.          } else {
  1352.             this.getAppletContext().showStatus(var3.format(new Object[]{var1, ""}));
  1353.          }
  1354.  
  1355.          if (this.grayBoxPainter != null) {
  1356.             if (this.status == 7) {
  1357.                this.grayBoxPainter.showLoadingError();
  1358.             } else if (this.status >= 3) {
  1359.                this.grayBoxPainter.suspendPainting();
  1360.             }
  1361.          }
  1362.  
  1363.          if (this.statusListener != null) {
  1364.             this.statusListener.statusChanged(this.status);
  1365.          }
  1366.       }
  1367.  
  1368.    }
  1369.  
  1370.    public void setDoInit(boolean var1) {
  1371.       this.doInit = var1;
  1372.    }
  1373.  
  1374.    public static String getMessage(String var0) {
  1375.       return ResourceHandler.getMessage(var0);
  1376.    }
  1377.  
  1378.    public static String[] getMessageArray(String var0) {
  1379.       return ResourceHandler.getMessageArray(var0);
  1380.    }
  1381.  
  1382.    protected AppletClassLoader createClassLoader(URL var1) {
  1383.       return ClassLoaderInfo.find(var1, this.getClassLoaderCacheKey()).getLoader();
  1384.    }
  1385.  
  1386.    protected void showAppletException(Throwable var1) {
  1387.       super.showAppletException(var1);
  1388.       Trace.msgPrintln("exception", new Object[]{var1.toString()});
  1389.       if (fShowException) {
  1390.          Trace.printException(var1);
  1391.       }
  1392.  
  1393.       if (this.grayBoxPainter != null) {
  1394.          this.grayBoxPainter.showLoadingError();
  1395.       }
  1396.  
  1397.    }
  1398.  
  1399.    public void showStatusText(String var1) {
  1400.       this.getAppletContext().showStatus(var1);
  1401.    }
  1402.  
  1403.    public void update(Graphics var1) {
  1404.       Dimension var2 = this.getSize();
  1405.       if (var2.width <= 0 || var2.height <= 0 || this.status != 1 && this.status != 2 && this.status != 7) {
  1406.          super.update(var1);
  1407.       } else {
  1408.          this.paintForegrnd(var1);
  1409.       }
  1410.  
  1411.    }
  1412.  
  1413.    public int getLoadingStatus() {
  1414.       return this.status;
  1415.    }
  1416.  
  1417.    public void windowActivated(WindowEvent var1) {
  1418.    }
  1419.  
  1420.    public void windowClosed(WindowEvent var1) {
  1421.    }
  1422.  
  1423.    public void windowClosing(WindowEvent var1) {
  1424.    }
  1425.  
  1426.    public void windowDeactivated(WindowEvent var1) {
  1427.    }
  1428.  
  1429.    public void windowDeiconified(WindowEvent var1) {
  1430.    }
  1431.  
  1432.    public void windowIconified(WindowEvent var1) {
  1433.    }
  1434.  
  1435.    public void windowOpened(WindowEvent var1) {
  1436.    }
  1437. }
  1438.